import java.sql.*;
//胖客户端
public class PhoneixJdbc {
    public static void main(String[] args) throws SQLException {
        //1.获取连接
        String url = "jdbc:phoenix:hadoop102,hadoop103,hadoop104:2181";
        Connection connection = DriverManager.getConnection(url);

        //2.获取语句预执行者  编译sql
        PreparedStatement preparedStatement = connection.prepareStatement("select * from student");

        //3.执行语句
        ResultSet resultSet = preparedStatement.executeQuery();

        //4.输出结果
        while (resultSet.next()){
            System.out.println(resultSet.getString(1)+"-"+resultSet.getString(2)+"-"+resultSet.getString(3));
        }

        preparedStatement.close();
        connection.close();

    }
}
